package cn.wowjoy.pda.android_pharmacy.mvvm.vm;

import com.github.jdsjlzx.recyclerview.LRecyclerViewAdapter;

import java.util.ArrayList;
import java.util.List;

import cn.bingoogolapple.androidcommon.adapter.BGABindingRecyclerViewAdapter;
import cn.wowjoy.pda.android_pharmacy.R;
import cn.wowjoy.pda.android_pharmacy.common.core.BaseViewModel;
import cn.wowjoy.pda.android_pharmacy.databinding.ItemRvDoorMedicineDetailBinding;
import cn.wowjoy.pda.android_pharmacy.model.xmlEntity.doorPatientInfo.DoorPatientInfoBeen;

/**
 * Created by sinyo on 2017/7/20.
 */

public class DoorTakeMedicineDetailViewModel extends BaseViewModel {
    public  ArrayList<DoorPatientInfoBeen> datas;

    public BGABindingRecyclerViewAdapter<DoorPatientInfoBeen, ItemRvDoorMedicineDetailBinding> wlinnerAdapter = new BGABindingRecyclerViewAdapter<>(R.layout.item_rv_door_medicine_detail);
    public LRecyclerViewAdapter wladapter = new LRecyclerViewAdapter(wlinnerAdapter);


    public void setWData(List<DoorPatientInfoBeen> data) {
        if (null == datas)
            datas = new ArrayList<>();
        datas.clear();
        datas.addAll(data);
        wlinnerAdapter.setData(datas);
        wladapter.removeFooterView();
        wladapter.removeHeaderView();
        wladapter.notifyDataSetChanged();
    }
    //检查当前所有药品中是否存在药品没有库位码
    public  List<DoorPatientInfoBeen> checkKW(){
        List<DoorPatientInfoBeen> mLists=new ArrayList<>();
        for(DoorPatientInfoBeen d : datas){
           if(null == d.getKFWZMC()){
               mLists.add(d);
           }
        }
        return mLists;
    }


}
